package com.mind.system.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.mind.common.annotation.Excel;
import com.mind.common.enums.RuleEditMode;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;


/**
 * 规则明细(AjRuleDetail)
 *
 * @author makejava
 * @since 2024-08-01 18:47:33
 */
@Data
public class AjRuleDetail implements Serializable {
    /**
     * 主键
     */
    @ExcelIgnore
    private Integer id;
    /**
     * 名称
     */
    @Excel(name = "名称")
    @ExcelProperty("名称")
    private String name;
    /**
     * 描述
     */
    @Excel(name = "描述")
    @ExcelProperty("描述")
    @TableField(value = "`desc`")
    private String desc;
    /**
     * 序号
     */
    @Excel(name = "序号")
    @ExcelProperty("序号")
    private Integer num;
    /**
     * 附件类型
     */
    @Excel(name = "附件类型")
    @ExcelProperty("附件类型")
    private String attachCate;
    /**
     * 规则集
     */
    @Excel(name = "规则集")
    @ExcelProperty("规则集")
    private String ruleGroup;
    /**
     * 规则编码
     */
    @Excel(name = "规则编码")
    @ExcelProperty("规则编码")
    private String code;
    /**
     * 规则变码(数字)
     */
    @Excel(name = "规则变码(数字)")
    @ExcelProperty("规则变码(数字)")
    private Integer codesort;
    /**
     * 告警信息
     */
    @Excel(name = "告警信息")
    @ExcelProperty("告警信息")
    private String alert;
    /**
     * 编辑器
     */
    @Excel(name = "编辑器")
    @ExcelProperty("编辑器")
    private String editor;
    /**
     * 创建时间
     */
    @ExcelIgnore
    private Date createTime;
    /**
     * 修改时间
     */
    @ExcelIgnore
    private Date updateTime;
    /**
     * 业务组别
     */
    @Excel(name = "业务组别")
    @ExcelProperty("业务组别")
    private String businessGroup;
    @TableField(exist = false)
    private Boolean isReference;

    private String ext1;
    private String ext2;
    private String ext3;
    private String ext4;
    private String ext5;
    private String ext6;
    private String ext7;
    private String ext8;
    private String ext9;
    private String ext10;

    public RuleEditMode getEditMode() {
        if (this.ext1 == null) {
            return RuleEditMode.Order;
        }
        if (this.ext1.equals("分级模式")) {
            return RuleEditMode.Scale;
        }
        if (this.ext1.equals("系统函数")) {
            return RuleEditMode.SysFunc;
        }
        if (this.ext1.equals("顺序模式")) {
            return RuleEditMode.Order;
        }
        return RuleEditMode.Order;
    }

}

